package com.snj.wef.ranking;

import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.util.Log;

import com.snj.lib.CustomHttpClient;
import com.snj.lib.Global;

public class RankingItem {
	
	String tag = "RankingItem";
	
	int rank = 0;
	int diff = 0;
	int index = 0;
	String partnername = "";
	String partnerimgsrc = "";
	Bitmap partnerimg = null;	
	
	public RankingItem(int _rank, int _diff, int _index, String _partnername, String _partnerimgsrc)
	{
		// TODO Auto-generated constructor stub
		
		this.rank = _rank;
		this.diff = _diff;
		this.index = _index;
		this.partnername = _partnername;
		this.partnerimgsrc = _partnerimgsrc;
		
		new AsyncTask<String, Bitmap, String>() {
					

			@Override
			protected void onPreExecute() {
				// TODO Auto-generated method stub
				super.onPreExecute();
				Log.d(tag, "PreExecute");
			}

			@Override
			protected String doInBackground(String... params) {
				// TODO Auto-generated method stub
				
				Log.d(tag, "Load From" + params[0]);
				partnerimg = CustomHttpClient.downloadBitmap(params[0]);;
				Log.d(tag, "Load Complete");
				
				return null;
			}
			
			
		}.execute(Global.baseurl + "ranking/partnerimg/" + partnerimgsrc);
		
	}
	
	public RankingItem(int _rank, int _diff, int _index, String _partnername, String _partnerimgsrc, Bitmap _partnerimg)
	{
		// TODO Auto-generated constructor stub
		
		this.rank = _rank;
		this.diff = _diff;
		this.index = _index;
		this.partnername = _partnername;
		this.partnerimgsrc = _partnerimgsrc;
		this.partnerimg = _partnerimg;
	}
	
	public Bitmap GetPartnerImage()
	{
		return this.partnerimg;
	}	
	
	public String GetPartnerImgSrc()
	{
		return this.partnerimgsrc;
	}
	
	public int GetRanking()
	{
		return this.rank;
	}
	
	public int GetDiff()
	{
		return this.diff;
	}
	
	public int GetIndex()
	{
		return this.index;
	}
	
	public String GetPartnerName()
	{
		return this.partnername;
	}
}
